package com.yanqu.road.server.gameplayer.module.activity.travelbook;

import com.yanqu.road.entity.travelbook.UserTravelAlbum;
import com.yanqu.road.entity.travelbook.UserTravelCard;
import com.yanqu.road.pb.activity.TravelBookProto;

/**
 * @Author : Cxp
 * @Time : 2024-11-13
 * @Description : 旅行册pb
 */

public class TravelBookPb {
    public static TravelBookProto.TravelBookAlbumTemp.Builder parseAlbum(UserTravelAlbum album) {
        TravelBookProto.TravelBookAlbumTemp.Builder res = TravelBookProto.TravelBookAlbumTemp.newBuilder();

        res.setAlbumId(album.getAlbumId());
        res.setBeautyId(album.getBeautyId());
        res.setLevel(album.getLevel());
        for (UserTravelCard card : album.getCards()) {
            res.addCard(parseCard(card));
        }

        return res;
    }

    public static TravelBookProto.TravelBookCardTemp.Builder parseCard(UserTravelCard card) {
        TravelBookProto.TravelBookCardTemp.Builder res = TravelBookProto.TravelBookCardTemp.newBuilder();

        res.setCardId(card.getCardId());
        res.setLevel(card.getLevel());
        res.setPatronId(card.getPatronId());
        res.setCd(card.getCd());

        return res;
    }
}
